﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CarForm.aspx.cs" Inherits="YhmOA.Integrated.Car.CarForm" %>

<%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=c6bed6029ccaee5e"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=c6bed6029ccaee5e"
    Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=c6bed6029ccaee5e"
    Namespace="DevExpress.Web.ASPxLoadingPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=c6bed6029ccaee5e"
    Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=c6bed6029ccaee5e"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>添加车辆</title>
    <link type="text/css" rel="Stylesheet" href="../../Styles/Common.css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.5.2.min.js"></script>
    <script type="text/javascript" src="../../Scripts/include.jquery.js"></script>
    <script type="text/javascript" src="../../Scripts/Common.js"></script>
    <script src="../../Scripts/DevEx.js" type="text/javascript"></script>
    <script type="text/javascript">
        function Save(s, e) {
            if (ASPxClientEdit.ValidateEditorsInContainer(null)) {
                var p = txt_PicPathCtrl.GetImageUrl().replace(GetLocationHost(), '~/');
                if (GetQS("mode") == "1") {
                    ConfirmDialog('提示信息', '是否要自动生成一条费用记录?', 250, 180,
                    function () {
                        cbSaveCtrl.PerformCallback(p + '|true');
                        lpSaveCtrl.Show();
                        $(this).wijdialog('close');
                    },
                    function () {
                        cbSaveCtrl.PerformCallback(p + '|false');
                        lpSaveCtrl.Show();
                        $(this).wijdialog('close');
                    });
                } else {
                    cbSaveCtrl.PerformCallback(p + '|false');
                    lpSaveCtrl.Show();
                    $(this).wijdialog('close');
                }
            }
        };
        function SaveCallback(s, e) {
            if (s.cpIsSucceed == true) {
                lpSaveCtrl.SetText('提交成功');
                parent.Search();
                window.setTimeout(function () { lpSaveCtrl.Hide(); lpSaveCtrl.SetText('正在提交信息,请稍后...'); }, 1500);
            } else {
                lpSaveCtrl.SetText('提交失败');
                window.setTimeout(function () { lpSaveCtrl.Hide(); lpSaveCtrl.SetText('正在提交信息,请稍后...'); }, 1500);
            }
        };
        //重置文本框
        function ResetEdit(s, e) {
            ASPxClientEdit.ClearEditorsInContainer(null);
            txt_CarTypeCtrl.Focus();
            txt_OilTypeCtrl.Focus();
            txt_ColourCtrl.Focus();
            txt_PlateNumCtrl.Focus();
            lpSaveCtrl.SetText('正在提交信息,请稍后...');
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="MainRound">
        <div class="MainRoundContent">
            <div class="MainRoundContentW">
                <div class="MainBody">
                    <table class="Table">
                        <tr>
                            <td style="width: 120px">
                                车牌号码：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_PlateNum" runat="server" MaxLength="20" NullText="请输入车牌号码"
                                    ClientInstanceName="txt_PlateNumCtrl" TabIndex="1" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入车牌号码"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                            <td style="width: 120px">
                                厂牌型号：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_PlateModel" runat="server" MaxLength="250" NullText="请输入厂牌型号"
                                    ClientInstanceName="txt_PlateModelCtrl" TabIndex="2" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入厂牌型号"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                车架号：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_FrameNum" runat="server" MaxLength="250" NullText="请输入车架号"
                                    ClientInstanceName="txt_FrameNumCtrl" TabIndex="3" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入车架号"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                            <td style="width: 120px">
                                行车证号：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_DrivingNum" runat="server" MaxLength="250" NullText="请输入行车证号"
                                    ClientInstanceName="txt_DrivingNumCtrl" TabIndex="4" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                行车证生效日期：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxDateEdit ID="txt_DrivingBeginTime" runat="server" TabIndex="5" NullText="请选择行车证生效日期"
                                    ClientInstanceName="txt_DrivingBeginTimeCtrl" Width="200px" Spacing="0">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择行车证生效日期"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxDateEdit>
                            </td>
                            <td style="width: 120px">
                                行车证失效日期：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxDateEdit ID="txt_DrivingEndTime" runat="server" TabIndex="6" NullText="请选择行车证失效日期"
                                    ClientInstanceName="txt_DrivingEndTimeCtrl" Width="200px" Spacing="0">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择行车证失效日期"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxDateEdit>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                车辆类型：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxComboBox ID="txt_CarType" runat="server" Width="200px" TabIndex="7" ClientInstanceName="txt_CarTypeCtrl"
                                    Spacing="0">
                                    <Items>
                                        <dx:ListEditItem Text="小轿车" Value="小轿车" />
                                        <dx:ListEditItem Text="货车" Value="货车" />
                                        <dx:ListEditItem Text="巴士" Value="巴士" />
                                    </Items>
                                    <ClientSideEvents Init="DevExObj.OnInit" LostFocus="DevExObj.OnLostFocus" GotFocus="DevExObj.OnGotFocus" />
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择车辆类型"
                                        ErrorFrameStyle-CssClass="TableNoBorder" ErrorText="请选择车辆类型">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                </dx:ASPxComboBox>
                            </td>
                            <td style="width: 120px">
                                发动机编号：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_EngineNum" runat="server" MaxLength="250" NullText="请输入发动机编号"
                                    ClientInstanceName="txt_EngineNumCtrl" TabIndex="8" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入发动机编号"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                出厂日期：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxDateEdit ID="txt_ProDate" runat="server" TabIndex="9" NullText="请选择出厂日期"
                                    Width="200px" ClientInstanceName="txt_ProDateCtrl" Spacing="0">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择出厂日期"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxDateEdit>
                            </td>
                            <td style="width: 120px">
                                购买日期：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxDateEdit ID="txt_BuyDate" runat="server" TabIndex="10" NullText="请选择购买日期"
                                    Width="200px" ClientInstanceName="txt_BuyDateCtrl" Spacing="0">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择购买日期"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxDateEdit>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                购买价格：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_BuyPrice" runat="server" MaxLength="18" NullText="请输入购买价格"
                                    ClientInstanceName="txt_BuyPriceCtrl" TabIndex="11" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入购买价格"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                        <RegularExpression ErrorText="只能输入非负数字" ValidationExpression="^\d+(\.\d+)?$" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                    <ClientSideEvents GotFocus="function(s,e){
                                        
                                    }" />
                                </dx:ASPxTextBox>
                            </td>
                            <td style="width: 120px">
                                初始里程(千米)：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_RoadHaul" runat="server" MaxLength="250" NullText="请输入初始里程"
                                    ClientInstanceName="txt_RoadHaulCtrl" TabIndex="12" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入初始里程"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                车辆颜色：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxComboBox ID="txt_Colour" runat="server" Width="200px" TabIndex="13" CssClass="TableNoBorder"
                                    ClientInstanceName="txt_ColourCtrl" Spacing="0">
                                    <Items>
                                        <dx:ListEditItem Text="黑" Value="黑" />
                                        <dx:ListEditItem Text="白" Value="白" />
                                        <dx:ListEditItem Text="灰" Value="灰" />
                                        <dx:ListEditItem Text="银" Value="银" />
                                        <dx:ListEditItem Text="蓝" Value="蓝" />
                                        <dx:ListEditItem Text="黄" Value="黄" />
                                        <dx:ListEditItem Text="红" Value="红" />
                                        <dx:ListEditItem Text="绿" Value="绿" />
                                    </Items>
                                    <ClientSideEvents Init="DevExObj.OnInit" LostFocus="DevExObj.OnLostFocus" GotFocus="DevExObj.OnGotFocus" />
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择车辆颜色"
                                        ErrorFrameStyle-CssClass="TableNoBorder" ErrorText="请选择车辆颜色">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                </dx:ASPxComboBox>
                            </td>
                            <td style="width: 120px">
                                使用油类：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxComboBox ID="txt_OilType" runat="server" Width="200px" TabIndex="14" CssClass="TableNoBorder"
                                    ClientInstanceName="txt_OilTypeCtrl" Spacing="0">
                                    <Items>
                                        <dx:ListEditItem Text="汽油" Value="汽油" />
                                        <dx:ListEditItem Text="柴油" Value="柴油" />
                                    </Items>
                                    <ClientSideEvents Init="DevExObj.OnInit" LostFocus="DevExObj.OnLostFocus" GotFocus="DevExObj.OnGotFocus" />
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请选择使用油类"
                                        ErrorFrameStyle-CssClass="TableNoBorder" ErrorText="请选择使用油类">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                </dx:ASPxComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                载重(吨)：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_LoadLimit" runat="server" MaxLength="250" NullText="请输入载重"
                                    ClientInstanceName="txt_LoadLimitCtrl" TabIndex="15" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入载重"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                        <RegularExpression ErrorText="只能输入非负数字" ValidationExpression="^\d+(\.\d+)?$" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                            <td style="width: 120px">
                                座位：
                            </td>
                            <td style="width: 250px">
                                <dx:ASPxTextBox ID="txt_SeatLimit" runat="server" MaxLength="250" NullText="请输入座位"
                                    ClientInstanceName="txt_SeatLimitCtrl" TabIndex="16" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入座位"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                        <RegularExpression ErrorText="只能输入正整数" ValidationExpression="^\+?[1-9][0-9]*$" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                一般用途：
                            </td>
                            <td style="width: 250px" colspan="3">
                                <dx:ASPxTextBox ID="txt_Purpose" runat="server" MaxLength="50" NullText="请输入一般用途"
                                    ClientInstanceName="txt_PurposeCtrl" TabIndex="17" Width="200px">
                                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" RequiredField-ErrorText="请输入一般用途"
                                        ErrorFrameStyle-CssClass="TableNoBorder">
                                        <RequiredField IsRequired="True" />
                                    </ValidationSettings>
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                备注：
                            </td>
                            <td style="width: 620px" colspan="3">
                                <dx:ASPxMemo ID="txt_Remarks" runat="server" MaxLength="250" NullText="请输入备注" Height="50px"
                                    ClientInstanceName="txt_RemarksCtrl" TabIndex="18" Width="580px">
                                    <NullTextStyle ForeColor="LightSteelBlue" />
                                </dx:ASPxMemo>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 120px">
                                图片：
                            </td>
                            <td style="width: 620px" colspan="3" class="TableNoBorder">
                                <dx:ASPxUploadControl ID="uplPicPath" runat="server" Width="580px" TabIndex="19"
                                    ShowUploadButton="true" OnFileUploadComplete="uplPicPath_FileUploadComplete"
                                    AddUploadButtonsSpacing="0px">
                                    <ClientSideEvents FileUploadComplete="function(s, e) {cbPicPathCtrl.PerformCallback(e.callbackData);lpPicPathCtrl.Show();}">
                                    </ClientSideEvents>
                                    <UploadButton Text="上传">
                                    </UploadButton>
                                </dx:ASPxUploadControl>
                                <div id="imgPicDiv">
                                    <dx:ASPxImage ID="txt_PicPath" runat="server" Height="62px" Width="100px" ClientInstanceName="txt_PicPathCtrl">
                                        <EmptyImage Url="~/Images/img_error.jpg">
                                        </EmptyImage>
                                    </dx:ASPxImage>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <br />
                    <table class="TableNoBorder" style="width: 740px">
                        <tr>
                            <td colspan="2" />
                            <td align="left" style="margin-right: 20px; width: 100px">
                                <dx:ASPxButton ID="btnSave" runat="server" Text="保  存" Width="80px" AutoPostBack="false"
                                    TabIndex="20">
                                    <ClientSideEvents Click="Save" />
                                </dx:ASPxButton>
                            </td>
                            <td align="left" style="margin-right: 20px; width: 100px">
                                <dx:ASPxButton ID="btnCancel" runat="server" Text="重  置" Width="80px" AutoPostBack="false"
                                    TabIndex="21" CausesValidation="False">
                                    <ClientSideEvents Click="ResetEdit" />
                                </dx:ASPxButton>
                            </td>
                        </tr>
                    </table>
                    <dx:ASPxCallback ID="cbPicPath" runat="server" ClientInstanceName="cbPicPathCtrl"
                        OnCallback="cbPicPath_Callback">
                        <ClientSideEvents CallbackComplete="function(s, e) {
                                txt_PicPathCtrl.SetImageUrl(GetLocationHost()+s.cpImgPicUrl);
                                lpPicPathCtrl.Hide();
                            }" />
                    </dx:ASPxCallback>
                    <dx:ASPxLoadingPanel ID="lpPicPath" runat="server" Text="正在上传图片.." ClientInstanceName="lpPicPathCtrl"
                        ContainerElementID="imgPicDiv">
                    </dx:ASPxLoadingPanel>
                    <dx:ASPxCallback ID="cbSave" runat="server" ClientInstanceName="cbSaveCtrl" OnCallback="cbSave_Callback">
                        <ClientSideEvents CallbackComplete="SaveCallback" />
                    </dx:ASPxCallback>
                    <dx:ASPxLoadingPanel ID="lpSave" runat="server" Text="正在提交信息,请稍后..." ClientInstanceName="lpSaveCtrl">
                    </dx:ASPxLoadingPanel>
                </div>
            </div>
        </div>
    </div>
    </form>
    <script type="text/javascript">
        
    </script>
</body>
</html>
